﻿using B.S.Sterilizationcenter.ErrorCode;
using B.S.Sterilizationcenter.Writer.API.Appliaction.Commends.Zmc.Warehou;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Sterilizationcenter.Writer.API.Controllers.ZMC
{
    /// <summary>
    /// 入库
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class WarehouController : ControllerBase
    {


        private readonly IMediator mediator;

        public WarehouController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 修改入库状态
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpPut]
        public async Task<ApiResult<int>> WarehouStatus(WarehouStatusCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 编辑入库单的物资信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPut]
        public async Task<ApiResult<int>> UpdataStuff(UpdataStuffCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }

        }



        /// <summary>
        /// 创建清洗数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpPost]
        public async Task<ApiResult<int>> CreateCleaningOrder(CreateCleaningOrderCommands request, CancellationToken cancellationToken)
        {
            try
            {

                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }



        /// <summary>
        /// 依据主键修改入库状态
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpPut]
        public async Task<ApiResult<int>> WarehousStutasWarehousId(WarehousStutasWarehousIdCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
